package com.ship.dispatch.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ship.dispatch.bean.ConResourceMemorandum;
import com.ship.dispatch.vo.SpYearPlanSchemeDetailExportVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author tangshixuan
 * @date 2023-8-31
 */
public interface ConResourceMemorandumMapper extends BaseMapper<ConResourceMemorandum> {

    /**
     * 根据id查询所有信息
     */
    @Select("SELECT * FROM con_resource_memorandum WHERE id = #{id}")
    ConResourceMemorandum getById(@Param("id") Long id);

    /**
     * 获取所有合同编号
     *
     * @return
     */
    @Select("SELECT * FROM con_resource_memorandum where trade_model = #{tradeModel} and trade_type in (1,2) and del_apply != 2")
    List<ConResourceMemorandum> getAllContractNumbers(@Param("tradeModel") Integer tradeModel);

    /**
     * 根据合同编号查出资源方（卖方）
     *
     * @return
     */
    @Select("SELECT seller FROM con_resource_memorandum where contract_number = #{contractNumber}")
    String getContractNumberBySeller(@Param("contractNumber") String contractNumber);

}
